<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%  
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>   
<%
		pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>删除商品类型</title>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<link href="${path}/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="${path}/js/jquery-3.2.1.min.js"></script> 
<script src="${path}/js/bootstrap.min.js"></script> 
<style >
	table,td,th{border:0px solid black;text-align:center;}
	td{text-align:center;}
</style>

<script type="text/javascript">
  		function checkDel(id){
  			if(window.confirm("是否删除该商品类型？")){
  				window.location.href = "/JEEBigHomework/adminType/deleteType?id="+id;
  			}
  		}
  </script>
</head>
<body>
	<div align="center">
		<c:if test="${PageInfo.list.size() == 0 }">
			您还没有类型。
		</c:if>
		<c:if test="${PageInfo.list.size() != 0 }">
			<div style="width: 100%; text-align: center;font-weight: bold;font-size: 20px; padding: 10px;">类型列表</div>
			<table border="1" bordercolor="black" class="table table-hover" style="text-align: center; width: 80%;" >
				<tr>
					<th width="200px">#</th>
					<th width="300px">类型名称</th>
					<th width="300px">删除操作</th>
				</tr>
				<c:forEach items="${PageInfo.list }" var="goodsType">
					<tr>
						<td>${goodsType.id }</td>
						<td>${goodsType.typename }</td>
						<td><a href="javascript:checkDel('${goodsType.id }')" class="btn btn-danger">删除</a></td>
					</tr>
				</c:forEach>
				<tr>
					<td colspan="3" style="font-size: 10px;">${msg }</td>
				</tr>
			</table>
		</c:if>
	
	</div>
	
	<!--分页分页  -->
	<div class="row" >
		<div class="col-md-6" align="center">
			当前 ${PageInfo.pageNum} 页 ，总共有${PageInfo.pages}页，总共${PageInfo.total}记录
		</div>
		<!--分页条  -->
		<div class="col-md-6">
			<nav aria-label="Page navigation">
				 <ul class="pagination">
				 
				 	<li><a href="${APP_PATH }/adminType/toDeleteGoodsType?pn=1">首页</a></li>
				 
				 <!--跳转前一页  -->
				 	<c:if test="${PageInfo.hasPreviousPage }">
				 			<li>
						      <a href="${APP_PATH }/adminType/toDeleteGoodsType?pn=${PageInfo.pageNum-1}" aria-label="Previous">
						        <span aria-hidden="true">&laquo;</span>
						      </a>
				    		</li>
					</c:if>
				 	
				<!--每一页  -->
					<c:forEach items="${PageInfo.navigatepageNums}" var="page">
				    	<c:if test="${page == PageInfo.pageNum }">
				    		<li class="active"><a href="#">${page}</a></li>
				    	</c:if>
				    	
				    	<c:if test="${page != PageInfo.pageNum }">
				    		<li><a href="${APP_PATH }/adminType/toDeleteGoodsType?pn=${page}">${page}</a></li>
				    	</c:if>
				    	
				    </c:forEach>
				    
				    <!--跳转下一页  -->
				    <c:if test="${PageInfo.hasNextPage }">
				    	<li>
					      <a href="${APP_PATH }/adminType/toDeleteGoodsType?pn=${PageInfo.pageNum+1}" aria-label="Next">
					        <span aria-hidden="true">&raquo;</span>
					      </a>
					    </li>
				    
				    </c:if>
				    
				    <li><a href="${APP_PATH }/adminType/toDeleteGoodsType?pn=${PageInfo.pages}">末页</a></li>
				  </ul>
			</nav>
		</div>
	</div>
	

</body>
</html>